﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace Library.Winform.Draw {
  public interface IObjectDraw : ISerializeDraw, IDisposable, ICloneable {
    /// <summary>
    /// Test for point belong to object.Return -1: No hit (hit out side of object). return 0: hit on object. return >0: hit at corner object (for resize)
    /// </summary>
    /// <param name="point">Point</param>
    /// <returns>return -1: No hit (hit out side of object). return 0: hit on object. return >0: hit at corner object (for resize)</returns>
    Int16 HitTest(Point point);

    /// <summary>
    /// Get Cursor at corner handle by object
    /// </summary>
    /// <param name="pointHandler"></param>
    /// <returns></returns>
    Cursor GetHandleCursor(UInt16 pointHandler);

    /// <summary>
    /// Get point handle by handler
    /// </summary>
    /// <param name="pointHandler"></param>
    /// <returns></returns>
    Point GetPointFromHandle(UInt16 pointHandler);

    /// <summary>
    /// Test whether object intersects with rectangle
    /// </summary>
    /// <param name="rectangle"></param>
    /// <returns></returns>
    bool IntersectsWith(Rectangle rectangle);


    /// <summary>
    /// Test whether point is inside of the object
    /// </summary>
    /// <param name="point"></param>
    /// <returns></returns>
    bool ContainPoint(Point point);

    /// <summary>
    /// Move object
    /// </summary>
    /// <param name="offsetX"></param>
    /// <param name="offsetY"></param>
    void Move(int offsetX, int offsetY);
    /// <summary>
    /// Move point at pointhandler to new newPoint
    /// </summary>
    /// <param name="pointHandler">Point handler</param>
    /// <param name="newPoint">new point for point handler</param>
    void MovePointHandleTo(UInt16 pointHandler, Point newPoint);

    /// <summary>
    /// Get or set Select object
    /// </summary>
    bool Selected { get; set; }

    /// <summary>
    /// Pen width, accept value in ranges [Int16.Min, Int16.Max]
    /// </summary>
    UInt16 PenWidth { get; set; }

    /// <summary>
    /// Pen color for draw
    /// </summary>
    Color PenColor { get; set; }

    /// <summary>
    /// container all point handle, element must > 0;
    /// </summary>
    UInt16[] HandlePoints { get; }


    /// <summary>
    /// Normalize object.
    /// Call this function in the end of object resizing.
    /// </summary>
    void Normalize();

    /// <summary>
    /// The container for graphics
    /// </summary>
    IDrawContainer GraphicsContainer { get; }

    /// <summary>
    /// Max position
    /// </summary>
    Point MaxPosition { get; }

    /// <summary>
    /// The menu context when user click right on the object
    /// </summary>
    ContextMenuStrip ContextMenuStrip { get; set; }
    /// <summary>
    /// object location
    /// </summary>
    Point Location { get; set; }
    /// <summary>
    /// force graphics container redraw this object only
    /// </summary>
    void Refresh();

		object Tag { get; set; }
  }
}
